home *** CD-ROM | disk | FTP | other *** search
- ;Structures
-
- ;***** exec/nodes.h *****
-
- NEWTYPE.MinNode
- *mln_Succ.MinNode
- *mln_Pred.MinNode
- End NEWTYPE
-
- ;***** utility/hooks.h *****
-
- NEWTYPE.Hook
- h_MinNode.MinNode
- *h_Entry.l
- *h_SubEntry.l
- *h_Data.b
- End NEWTYPE
-
- ;***** intuition/classes.h *****
-
- NEWTYPE.IClass
- cl_Dispatcher.Hook
- cl_Reserved.l
- *cl_Super.IClass
- *cl_ID.b
- cl_InstOffset.w
- cl_InstSize.w
- cl_UserData.l
- cl_SubclassCount.l
- cl_Flags.l
- End NEWTYPE
-
- NEWTYPE._Object
- o_Node.MinNode
- *o_Class.IClass
- End NEWTYPE
-
- ;***** datatypes/soundclass.h *****
-
- NEWTYPE.VoiceHeader
- vh_OneShotHiSamples.l
- vh_RepeatHiSamples.l
- vh_SamplesPerHiCycle.l
- vh_SamplesPerSec.w
- vh_Octaves.b
- vh_Compression.b
- vh_Volume.l
- End NEWTYPE
-
-
- ;Defines
-
- ;***** datatypes/datatypesclass.h *****
-
- #DTA_Dummy=((1LSL31)+$1000)
- #DTA_SourceType=(#DTA_Dummy+101)
- #DTA_GroupID=(#DTA_Dummy+31)
-
- #DTST_FILE=2
-
- #DTM_TRIGGER=($631)
-
- #STM_PLAY=2
-
- ;***** datatypes/datatypes.h *****
-
- #GID_SOUND=$73 6F 75 6E
- ; s o u n
-
- ;***** datatypes/soundclass.h *****
-
- #SDTA_Dummy=(#DTA_Dummy+500)
- #SDTA_VoiceHeader=(#SDTA_Dummy+1)
- #SDTA_Sample=(#SDTA_Dummy+2)
- #SDTA_SampleLength=(#SDTA_Dummy+3)
- #SDTA_Volume=(#SDTA_Dummy+5)
- #SDTA_Cycles=(#SDTA_Dummy+6)
-
- ;***** *****
-
- NEWTYPE.tags:a.l:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:End NEWTYPE
-
- DEFTYPE.VoiceHeader *vhdr ;VoiceHeader allows to get infos about sound
- DEFTYPE.l sample,samplelength
-
- MaxLen name$=120
- Dim *args.b(1)
-
- ;We read the args
-
- rdargs.l=ReadArgs_("/A",&*args(0),0)
-
- If rdargs=0 ;No args ???
- NPrint "No Args !!"
- End ;YES => End
- EndIf
- ;NO => Continue
-
- name$=Peek$(*args(0)) ;Get the filename from the read args
-
- FreeArgs_ rdargs
-
- ;We define the tags for the DTObject creation
- ;#DTA_SourceType : #DTST_FILE - The object is a file (it could be ram or
- ;clipboard)
- ;#DTA_GroupID : #GID_SOUND - We only want a sound (not a picture, a text or
- ;an anim
- ;#SDTA_Volume : 64 - We set the volume to 64 (maximum)
- ;#STDA_Cycles : 1 - Only one time
-
- tags.tags\a=#DTA_SourceType,#DTST_FILE,#DTA_GroupID,#GID_SOUND,#SDTA_Volume,64,#SDTA_Cycles,1,0
-
- *o._Object=NewDTObjectA_(&name$,tags) ;We make it
-
- If *o=0 ;ERROR ???
- NPrint name$," : DTObject creation failed !!"
- End ;YES=> End
- EndIf
-
- attrs.tags\a=#SDTA_VoiceHeader,&*vhdr,#SDTA_Sample,&sample,#SDTA_SampleLength,&samplelength,0
-
- ;We get attrs from the DTObject
- ;#SDTA_VoiceHeader : &*vhdr - We get the VoiceHeader structure in order to
- ;have some infos on the sound (Samples per second ,...)
- ;#SDTA_Sample : &sample - We get the sample of the sound in the sample variable
- ;#SDTA_SampleLength : &samplelength - The Sample Length !
-
- GetDTAttrsA_ *o,attrs
-
- a.l=DoMethod(*o,#DTM_TRIGGER,0,#STM_PLAY,0) ;We play the sound
-
- length.l=(((samplelength/*vhdr\vh_SamplesPerSec)*50)+50) ;Length of the sound in ticks
- lens.f=length/50 ;Length of the sound in seconds
- NPrint name$," : ",lens," s" ;Display infos
-
- Delay_ length
-
- DisposeDTObject_ *o ;Free the DTObject
-
- End ;FINISH !!!
-